Applies a formula update expression (e.g. ~ . + hp or
~ . - disp) to a model_spec object, using the same
dot-notation as update.formula.
Usage
# S3 method for class 'model_spec'
update(object, formula., ...)Arguments
- object
A
model_specobject.- formula.
A one-sided formula describing the update, e.g.
~ . + hp,~ . - disp, or~ hp(replace all terms). Use~ . - 1to suppress the intercept. The update applies to the main terms only: parts (seeset_parts) are kept as they are, and a|is an error.- ...
Unused; present for S3 generic compatibility.
Examples
base_m <- model_spec(cyl, disp)
update(base_m, ~ . + hp)
#> model_spec: ~ cyl + disp + hp
update(base_m, ~ . - disp)
#> model_spec: ~ cyl
update(base_m, ~ . - 1) # suppress intercept
#> model_spec: ~ 0 + cyl + disp